import {  getCoordLinat} from '@/api/gisManage/gisManage'
import {getdevPList,getDevInfoList} from '@/api/gisManage/device'
let state = {
    devPList: {},
    coordLinat:{},
    devList:{}
}
const actions = {
    // 获取用户列表信息
    async actionGetDevPList({ commit }) {
        const res = await getdevPList()
        console.log('设备坐标', res)
        commit('SET_DEVPLIST', res)
    },
    // 获取管网数据
    async actionGetCoordLinat({commit}){
        const res = await getCoordLinat()
        console.log('管网数据',res.data.featureslist)
        commit('SET_COORDLINAT',res.data.featureslist)
    },
    // 获取设备列表
    async actionGetDevList({commit},pageInfo){
        const res = await getDevInfoList(pageInfo)
        console.log('设备信息',res)
        commit('SET_DEVLIST',res)
    }

}
const mutations = {
    // 将用户列表信息存入vuex
    SET_DEVPLIST: (state, res) => {
        state.devPList = res
    },
    // 将官网列表信息存入vuex
    SET_COORDLINAT:(state, res)=>{
        state.coordLinat = res
    },
    SET_DEVLIST:(state,res)=>{
        state.devList = res
    }
}
export default {
    namespaced: true,
    state,
    actions,
    mutations
}